package com.kanshu.ksgb.fastread.doudou.module.personal.activity

import android.content.Context
import com.dl7.recycler.adapter.BaseQuickAdapter
import com.dl7.recycler.adapter.BaseViewHolder
import com.kanshu.ksgb.fastread.doudou.R
import com.kanshu.ksgb.fastread.doudou.common.util.DisplayUtils.gone
import com.kanshu.ksgb.fastread.doudou.common.util.DisplayUtils.visible
import com.kanshu.ksgb.fastread.doudou.module.personal.bean.FeedbackBean

/**
 * Title:
 * Description:
 * Copyright: Copyright(c)2018
 * Company: 看书网
 * CreateTime: 2018/4/19 16:25
 *
 * @author EvanHe
 * @version 1.0
 */
class MyFeedbackAdapter(val context: Context, val list: MutableList<FeedbackBean>) : BaseQuickAdapter<FeedbackBean>(context, list) {


    override fun convert(holder: BaseViewHolder?, item: FeedbackBean?, position: Int) {
        holder?.apply {
            setText(R.id.feedback_content, item?.content)
            setText(R.id.feedback_time, item?.createtime)
            if (item?.suggest_reply != null) {
                setText(R.id.reply_text, "回复")
                setTextColor(R.id.reply_text, context.resources.getColor(R.color.other_word_color))
                visible(holder.getView(R.id.reply_content), holder.getView(R.id.reply_time), holder.getView(R.id.split_line))
                setText(R.id.reply_content, item?.suggest_reply.content)
                setText(R.id.reply_time, item?.suggest_reply.createtime)
            } else {
                setText(R.id.reply_text, "待回复")
                setTextColor(R.id.reply_text, context.resources.getColor(R.color.theme))
                gone(holder.getView(R.id.reply_content), holder.getView(R.id.reply_time), holder.getView(R.id.split_line))
            }
        }
    }

    override fun attachLayoutRes() = R.layout.item_my_feedback

}
